import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class demo7 {
    public static void main(String[] args) throws IOException {
        //new 操作就相当于打开文件---通过try with resources来实现自动关闭文件,,,必须实现Closeable接口
        try(InputStream inputStream = new FileInputStream("d:/tmp/file/test.txt");){
            //读文件操作
            while(true) {
                int t = inputStream.read();//一次一个字节.读完返回-1
                if (t == -1) {
                    break;//读完
                }
                System.out.println(t);
            }
           /* byte[] bytes = new byte[5];
            while (true){
                int t = inputStream.read(bytes);//一次一个字节.读完返回-1
                if (t == -1) {
                    break;//读完
                }
            }
            for(int i=0;i< bytes.length;i++){
                System.out.printf("0x%x\n", bytes[i]);
            }*/




        }


    }



}
